<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	template="/WEB-INF/templates/general.xhtml">

	<ui:define name="title">
		<h:outputText value="Registration" />
	</ui:define>

	<ui:define name="body">
		<h:form id="form">
			<p:panel header="New User"> 
				<p:messages id="messages" showDetail="false" autoUpdate="true" closable="false"/>  
				
				<h:panelGrid columns="2"> 
					<h:outputText value="First Name:" />
					<p:inputText id="newUserFirstName" value="#{userBean.userFirstName}"
						title="Enter your First Name!"/> 
					
					<h:outputText value="Last Name:" />
					<p:inputText id="newUserLastName" value="#{userBean.userLastName}"/> 
					 
					<h:outputText value="Login:" />
					<p:inputText id="newUserLogin" value="#{userBean.userLogin}"/> 
								
					<h:outputText value="Password:" />
					<p:password id="newUserPassword1" value="#{userBean.userPassword}" match="newUserPassword2"  
						required="true" label="Password 1" feedback="true"/>   

					<h:outputText value="Confirm password:" />
					<p:password id="newUserPassword2" value="#{userBean.userPassword}"  required="true" label="Password 2"/>   
					 
					<h:outputText value="Personas kods:" />
					<p:inputMask value="#{userBean.userPersonalNumber}" mask="999999-99999"/>   
				
					<p:commandButton value="New User" update="form"
							id="saveNewUserButton" actionListener="#{userBean.addNewUser}"/>											
				</h:panelGrid>							
			</p:panel>
		</h:form>
		
		<h:form>
			<h:panelGrid columns="1">
				<p:fileUpload fileUploadListener="#{userBean.handleFileUpload}"  
            	mode="advanced"   
            	update="fileUploadMessages"  
            	sizeLimit="900000"   
            	allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />  
  
    			<p:growl id="fileUploadMessages" showDetail="true"/> 
			</h:panelGrid>	
		</h:form>
	</ui:define>	
</ui:composition>
